﻿using Microsoft.AspNetCore.Http;
using System;

namespace CommonUtils
{
    public class WebMessage
    {
        public string Id;

        public string Url;

        public string Host;

        public string HiddenHost
        {
            get
            {
                return IpUtil.Hide(Host);
            }
        }

        public DateTime Time;

        public string Content;

        public WebMessage(HttpRequest request, string message)
        {
            Id = StringUtil.GetUpperredGuidWithoutBars();
            Url = request.GetUrl();
            Host = request.HttpContext.Connection.RemoteIpAddress.ToString();
            Time = DateTime.Now;
            Content = message;
        }

        public WebMessage()
        {

        }
    }
}
